editor
OK
class OK(EditorSuccess)
Editor success code 0.
OKWithCleaning
class OKWithCleaning(EditorSuccess)
Editor success code 1.
success_codes
success_codes = {
0: OK,
1: OKWithCleaning,
}
UnknownErrorCode
class UnknownErrorCode(EditorError)
Unknown error code.
GeneralFail
class GeneralFail(EditorError)
Editor error code -1.
UnexpectedEndOfFile
class UnexpectedEndOfFile(EditorError)
Editor error code -2.
LicenceExpired
class LicenceExpired(EditorError)
Editor error code -3.
LicenseExpired
LicenseExpired = LicenceExpired
alias <= 0.2.42
IncorrectSessionSetup
class IncorrectSessionSetup(EditorError)
Editor error code -4.
IncorrectPolicySetup
class IncorrectPolicySetup(EditorError)
Editor error code -5.
UnableToLoadInput
class UnableToLoadInput(EditorError)
Editor error code -6.
FileTypeUnknown
class FileTypeUnknown(EditorError)
Editor error code -7.
UnknownSessionID
class UnknownSessionID(EditorError)
Editor error code -8.
ArgumentError
class ArgumentError(EditorError)
Editor error code -9.
UnableToLoadImport
class UnableToLoadImport(EditorError)
Editor error code -10.
CameraDidNotInitialise
class CameraDidNotInitialise(EditorError)
Editor error code -11.
NoCamerasConnected
class NoCamerasConnected(EditorError)
Editor error code -12.
EngineeringOnlyGoesToFile
class EngineeringOnlyGoesToFile(EditorError)
Editor error code -13.
UnableToWriteOutput
class UnableToWriteOutput(EditorError)
Editor error code -14
UnableToWriteExport
class UnableToWriteExport(EditorError)
Editor error code -15
FileRejected
class FileRejected(EditorError)
Editor error code -16
UnableToWriteExportTextDump
class UnableToWriteExportTextDump(EditorError)
Editor error code -17
UnableToWriteAnalysisReport
class UnableToWriteAnalysisReport(EditorError)
Editor error code -18
InputTooLarge
class InputTooLarge(EditorError)
Editor error code -19
InputZeroBytes
class InputZeroBytes(EditorError)
Editor error code -20
error_codes
error_codes = {
-1: GeneralFail,
-2: UnexpectedEndOfFile,
-3: LicenseExpired,
-4: In ...
Editor
class Editor(Library)
A high level Python wrapper for Glasswall Editor / Core2.
__init__
def __init__(library_path: str,
licence: Union[str, bytes, bytearray, io.BytesIO] = None)
Initialise the Editor instance.
Arguments:
library_pathstr - The file or directory path to the Editor library.licencestr, bytes, bytearray, or io.BytesIO, optional - The licence file content or path. This can be:- A string representing the file path to the licence.
- A
bytesorbytearrayobject containing the licence data. - An
io.BytesIOobject for in-memory licence data. If not specified, it is assumed that the licence file is located in the same directory as thelibrary_path.
validate_licence
def validate_licence()
Validates the licence of the library by checking the licence details.
Raises:
LicenceExpired- If the licence has expired or could not be validated.
version
def version()
Returns the Glasswall library version.
Returns:
versionstr - The Glasswall library version.
open_session
def open_session()
Open a new Glasswall session.
Returns:
sessionint - An incrementing integer repsenting the current session.
close_session
def close_session(session: int) -> int
Close the Glasswall session. All resources allocated by the session will be destroyed.
Arguments:
sessionint - The session to close.
Returns:
statusint - The status code of the function call.
new_session
@contextmanager
def new_session()
Context manager. Opens a new session on entry and closes the session on exit.
run_session
def run_session(session)
Runs the Glasswall session and begins processing of a file.
Arguments:
sessionint - The session to run.
Returns:
statusint - The status code of the function call.
determine_file_type
def determine_file_type(input_file: Union[str, bytes, bytearray, io.BytesIO],
as_string: bool = False,
raise_unsupported: bool = True) -> Union[int, str]
Determine the file type of a given input file, either as an integer identifier or a string.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file to analyse. It can be provided as a file path (str), bytes, bytearray, or a BytesIO object.as_stringbool, optional - Return file type as string, eg: "bmp" instead of: 29. Defaults to False.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_typeUnion[int, str] - The file type.
get_content_management_policy
def get_content_management_policy(session: int)
Returns the content management configuration for a given session.
Arguments:
sessionint - The session integer.
Returns:
xml_stringstr - The XML string of the current content management configuration.
set_content_management_policy
def set_content_management_policy(
session: int,
input_file: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
policy_format=0)
Sets the content management policy configuration. If input_file is None then default settings (sanitise) are applied.
Arguments:
sessionint - The session integer.input_fileUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - Default None (sanitise). The content management policy to apply.policy_formatint - The format of the content management policy. 0=XML.
Returns:
-
result (glasswall.GwReturnObj): Depending on the input 'input_file':
-
If input_file is a str file path:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'policy_format', 'status'.
-
If input_file is a file in memory:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'policy_format', 'status'.
register_input
def register_input(session: int, input_file: Union[str, bytes, bytearray,
io.BytesIO])
Register an input file or bytes for the given session.
Arguments:
sessionint - The session integer.input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.
Returns:
-
result (glasswall.GwReturnObj): Depending on the input 'input_file':
-
If input_file is a str file path:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'status'.
-
If input_file is a file in memory:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
register_output
def register_output(session, output_file: Optional[str] = None)
Register an output file for the given session. If output_file is None the file will be returned as 'buffer' and 'buffer_length' attributes.
Arguments:
sessionint - The session integer.output_fileOptional[str] - If specified, during run session the file will be written to output_file, otherwise the file will be written to the glasswall.GwReturnObj 'buffer' and 'buffer_length' attributes.
Returns:
gw_return_objectglasswall.GwReturnObj - A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
register_analysis
def register_analysis(session: int, output_file: Optional[str] = None)
Registers an analysis file for the given session. The analysis file will be created during the session's run_session call.
Arguments:
sessionint - The session integer.output_fileOptional[str] - Default None. The file path where the analysis will be written. None returns the analysis as bytes.
Returns:
gw_return_objectglasswall.GwReturnObj - A GwReturnObj instance with the attributes 'status', 'session', 'analysis_format'. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size. If output_file is not None (file mode) 'output_file' is included.
protect_file
def protect_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Protects a file using the current content management configuration, returning the file bytes. The protected file is written to output_file if it is provided.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the protected file will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_bytesbytes - The protected file bytes.
protect_directory
def protect_directory(
input_directory: str,
output_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Recursively processes all files in a directory in protect mode using the given content management policy. The protected files are written to output_directory maintaining the same directory structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to protect.output_directoryOptional[str] - The output directory where the protected file will be written, or None to not write files.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - Default None (sanitise). The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
protected_files_dictdict - A dictionary of file paths relative to input_directory, and file bytes.
analyse_file
def analyse_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Analyses a file, returning the analysis bytes. The analysis is written to output_file if it is provided.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the analysis file will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_bytesbytes - The analysis file bytes.
analyse_directory
def analyse_directory(
input_directory: str,
output_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Analyses all files in a directory and its subdirectories. The analysis files are written to output_directory maintaining the same directory structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to analyse.output_directoryOptional[str] - The output directory where the analysis files will be written, or None to not write files.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - Default None (sanitise). The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
analysis_files_dictdict - A dictionary of file paths relative to input_directory, and file bytes.
protect_and_analyse_file
def protect_and_analyse_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
output_analysis_report: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Protects and analyses a file in a single session, returning both protected file bytes and analysis report bytes.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the protected file will be written.output_analysis_reportOptional[str] - The output file path where the XML analysis report will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
Tuple[Optional[bytes], Optional[bytes]]: A tuple of (protected_file_bytes, analysis_report_bytes).
protect_and_analyse_directory
def protect_and_analyse_directory(
input_directory: str,
output_directory: Optional[str] = None,
analysis_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Recursively processes all files in a directory using protect and analyse mode with the given content management policy. Outputs are written to output_directory and analysis_directory maintaining the same structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to process.output_directoryOptional[str] - The output directory for protected files.analysis_directoryOptional[str] - The output directory for XML analysis reports.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
result_dictdict - A dictionary mapping relative file paths to tuples of (protected_file_bytes, analysis_report_bytes).
register_export
def register_export(session: int, output_file: Optional[str] = None)
Registers a file to be exported for the given session. The export file will be created during the session's run_session call.
Arguments:
sessionint - The session integer.output_fileOptional[str] - Default None. The file path where the export will be written. None exports the file in memory.
Returns:
gw_return_objectglasswall.GwReturnObj - A GwReturnObj instance with the attribute 'status' indicating the result of the function call and 'session', the session integer. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
export_file
def export_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Export a file, returning the .zip file bytes. The .zip file is written to output_file if it is provided.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the .zip file will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_bytesbytes - The exported .zip file.
export_directory
def export_directory(
input_directory: str,
output_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Exports all files in a directory and its subdirectories. The export files are written to output_directory maintaining the same directory structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to export.output_directoryOptional[str] - The output directory where the export files will be written, or None to not write files.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - Default None (sanitise). The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
export_files_dictdict - A dictionary of file paths relative to input_directory, and file bytes.
export_and_analyse_file
def export_and_analyse_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
output_analysis_report: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Exports and analyses a file in a single session, returning both exported .zip bytes and analysis report bytes.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the .zip export will be written.output_analysis_reportOptional[str] - The output file path where the XML analysis report will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
Tuple[Optional[bytes], Optional[bytes]]: A tuple of (export_file_bytes, analysis_report_bytes).
export_and_analyse_directory
def export_and_analyse_directory(
input_directory: str,
output_directory: Optional[str] = None,
analysis_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Recursively processes all files in a directory using export and analyse mode with the given content management policy. Outputs are written to output_directory and analysis_directory maintaining the same structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to process.output_directoryOptional[str] - The output directory for exported .zip files.analysis_directoryOptional[str] - The output directory for XML analysis reports.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
result_dictdict - A dictionary mapping relative file paths to tuples of (export_file_bytes, analysis_report_bytes).
register_import
def register_import(session: int, input_file: Union[str, bytes, bytearray,
io.BytesIO])
Registers a .zip file to be imported for the given session. The constructed file will be created during the session's run_session call.
Arguments:
sessionint - The session integer.input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input import file path or bytes.
Returns:
gw_return_objectglasswall.GwReturnObj - A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
import_file
def import_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Import a .zip file, constructs a file from the .zip file and returns the file bytes. The file is written to output_file if it is provided.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The .zip input file path or bytes.output_fileOptional[str] - The output file path where the constructed file will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_bytesbytes - The imported file bytes.
import_directory
def import_directory(
input_directory: str,
output_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Imports all files in a directory and its subdirectories. Files are expected as .zip but this is not forced. The constructed files are written to output_directory maintaining the same directory structure as input_directory.
Arguments:
input_directorystr - The input directory containing files to import.output_directoryOptional[str] - The output directory where the constructed files will be written, or None to not write files.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - Default None (sanitise). The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
import_files_dictdict - A dictionary of file paths relative to input_directory, and file bytes.
import_and_analyse_file
def import_and_analyse_file(
input_file: Union[str, bytes, bytearray, io.BytesIO],
output_file: Optional[str] = None,
output_analysis_report: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Imports and analyses a file in a single session, returning both imported file bytes and analysis report bytes.
Arguments:
input_fileUnion[str, bytes, bytearray, io.BytesIO] - The input file path or bytes.output_fileOptional[str] - The output file path where the imported file will be written.output_analysis_reportOptional[str] - The output file path where the XML analysis report will be written.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply to the session.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
Tuple[Optional[bytes], Optional[bytes]]: A tuple of (import_file_bytes, analysis_report_bytes).
import_and_analyse_directory
def import_and_analyse_directory(
input_directory: str,
output_directory: Optional[str] = None,
analysis_directory: Optional[str] = None,
content_management_policy: Union[
None, str, bytes, bytearray, io.BytesIO,
"glasswall.content_management.policies.policy.Policy"] = None,
raise_unsupported: bool = True)
Recursively processes all files in a directory using import and analyse mode with the given content management policy. Outputs are written to output_directory and analysis_directory maintaining the same structure as input_directory.
Arguments:
input_directorystr - The input directory containing export .zip files to process.output_directoryOptional[str] - The output directory for imported files.analysis_directoryOptional[str] - The output directory for XML analysis reports.content_management_policyUnion[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional - The content management policy to apply.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
result_dictdict - A dictionary mapping relative file paths to tuples of (import_file_bytes, analysis_report_bytes).
file_error_message
@functools.lru_cache()
def file_error_message(session: int) -> str
Retrieve the Glasswall Session Process error message.
Arguments:
sessionint - The session integer.
Returns:
error_messagestr - The Glasswall Session Process error message.
GW2GetFileType
def GW2GetFileType(session: int, file_type_id)
Retrieve the file type as a string.
Arguments:
sessionint - The session integer.file_type_idint - The file type id.
Returns:
file_typestr - The formal file name for the corresponding file id.
GW2GetFileTypeID
def GW2GetFileTypeID(session: int, file_type_str)
Retrieve the Glasswall file type id given a file type string.
Arguments:
sessionint - The session integer.file_type_strstr - The file type as a string.
Returns:
file_type_idstr - The Glasswall file type id for the specified file type.
get_file_type_info
def get_file_type_info(file_type: Union[str, int])
Retrieve information about a file type based on its identifier.
Arguments:
file_typeUnion[str, int] - The file type identifier. This can be either a string representing a file extension (e.g. 'bmp') or an integer corresponding to a file type (e.g. 29).
Returns:
- file_type_info (Union[int, str]): Depending on the input 'file_type':
- If
file_typeis a string (e.g. 'bmp'): - If the file type is recognised, returns an integer corresponding to that file type.
- If the file type is not recognised, returns 0.
- If
file_typeis an integer (e.g. 29): - If the integer corresponds to a recognised file type, returns a more detailed string description of the file type (e.g. 'BMP Image').
- If the integer does not match any recognised file type, returns an empty string.
get_file_info
@utils.deprecated_function(replacement_function=get_file_type_info)
def get_file_info(*args, **kwargs)
Deprecated in 1.0.6. Use get_file_type_info.
register_report_file
def register_report_file(session: int, output_file: str)
Register the report file path for the given session.
Arguments:
sessionint - The session integer.output_filestr - The file path of the report file.
Returns:
gw_return_objectglasswall.GwReturnObj - A GwReturnObj instance with the attributes 'session', 'output_file', 'status'.
get_id_info
def get_id_info(issue_id: int, raise_unsupported: bool = True)
Retrieves the group description for the given Issue ID. e.g. issue_id 96 returns "Document Processing Instances"
Arguments:
issue_idint - The issue id.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
id_infostr - The group description for the given Issue ID.
get_all_id_info
def get_all_id_info(output_file: Optional[str] = None,
raise_unsupported: bool = True) -> str
Retrieves the XML containing all the Issue ID ranges with their group descriptions
Arguments:
output_fileOptional[str] - The output file path where the analysis file will be written.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
all_id_infostr - A string XML analysis report containing all id info.
file_session_status_message
def file_session_status_message(session: int,
raise_unsupported: bool = True) -> str
Retrieves the Glasswall session status message. Gives a high level indication of the processing that was carried out.
Arguments:
sessionint - The session integer.raise_unsupportedbool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
result.message (str):The file session status message.
licence_details
def licence_details()
Returns a string containing details of the licence.
Returns:
resultstr - A string containing details of the licence.
register_licence
def register_licence(session: int, input_file: Union[str, bytes, bytearray,
io.BytesIO])
Registers a "gwkey.lic" licence from file path or memory.
Arguments:
sessionint - The session integer.input_fileUnion[str, bytes, bytearray, io.BytesIO] - The "gwkey.lic" licence. It can be provided as a file path (str), bytes, bytearray, or a BytesIO object.
Returns:
-
result (glasswall.GwReturnObj): Depending on the input 'input_file':
-
If input_file is a str file path:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'status'.
-
If input_file is a file in memory:
-
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
EditorError
class EditorError(Exception)
Base class for all Glasswall Editor errors.
EditorSuccess
class EditorSuccess()
Base class for all Glasswall Editor successes.